<template>
    <view>
        <!--标题和返回-->
		<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName">
			<block slot="backText">返回</block>
			<block slot="content">容器表</block>
		</cu-custom>
		 <!--表单区域-->
		<view>
			<form>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器名称：</text></view>
                  <input  placeholder="请输入容器名称" v-model="model.conName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">labelName：</text></view>
                  <input  placeholder="请输入labelName" v-model="model.labelName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">labelBak：</text></view>
                  <input  placeholder="请输入labelBak" v-model="model.labelBak"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器宽度：</text></view>
                  <input  placeholder="请输入容器宽度" v-model="model.conWidth"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器类型：</text></view>
                  <input  placeholder="请输入容器类型" v-model="model.conType"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">页面id：</text></view>
                  <input  placeholder="请输入页面id" v-model="model.pageId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">是否锁定：</text></view>
                  <input  placeholder="请输入是否锁定" v-model="model.isLock"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器字体大小：</text></view>
                  <input  placeholder="请输入容器字体大小" v-model="model.fontSize"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器x轴名字：</text></view>
                  <input  placeholder="请输入容器x轴名字" v-model="model.xName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器y轴名字：</text></view>
                  <input  placeholder="请输入容器y轴名字" v-model="model.yName"/>
                </view>
              </view>
              <my-date label="创建容器时间：" v-model="model.createTiime" placeholder="请输入创建容器时间"></my-date>
              <my-date label="删除容器时间：" v-model="model.deleteTime" placeholder="请输入删除容器时间"></my-date>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">是否删除标志：</text></view>
                  <input  placeholder="请输入是否删除标志" v-model="model.delFlag"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">创建者：</text></view>
                  <input  placeholder="请输入创建者" v-model="model.creator"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">更新人：</text></view>
                  <input  placeholder="请输入更新人" v-model="model.updater"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器长度：</text></view>
                  <input  placeholder="请输入容器长度" v-model="model.conHeight"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器保存的ids表id：</text></view>
                  <input  placeholder="请输入容器保存的ids表id" v-model="model.xmlIdSet"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">播放时间单位 ：</text></view>
                  <input  placeholder="请输入播放时间单位 " v-model="model.cacheSet"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">是否订阅：</text></view>
                  <input  placeholder="请输入是否订阅" v-model="model.subFlag"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器类型ip或存储下行：</text></view>
                  <input  placeholder="请输入容器类型ip或存储下行" v-model="model.downloadType"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器频率：</text></view>
                  <input  placeholder="请输入容器频率" v-model="model.grabf"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">容器频率：</text></view>
                  <input  placeholder="请输入容器频率" v-model="model.frequency"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">cacheSetBigint：</text></view>
                  <input  placeholder="请输入cacheSetBigint" v-model="model.cacheSetBigint"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">autoSet：</text></view>
                  <input  placeholder="请输入autoSet" v-model="model.autoSet"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">posterizeTime：</text></view>
                  <input  placeholder="请输入posterizeTime" v-model="model.posterizeTime"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">conOrder：</text></view>
                  <input  placeholder="请输入conOrder" v-model="model.conOrder"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">fullview：</text></view>
                  <input  placeholder="请输入fullview" v-model="model.fullview"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">miniview：</text></view>
                  <input  placeholder="请输入miniview" v-model="model.miniview"/>
                </view>
              </view>
				<view class="padding">
					<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit">
						<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交
					</button>
				</view>
			</form>
		</view>
    </view>
</template>

<script>
    import myDate from '@/components/my-componets/my-date.vue'

    export default {
        name: "GdqvConForm",
        components:{myDate},
        props:{
          formData:{
              type:Object,
              default:()=>{},
              required:false
          }
        },
        data(){
            return {
				CustomBar: this.CustomBar,
				NavBarColor: this.NavBarColor,
				loading:false,
                model: {},
                backRouteName:'index',
                url: {
                  queryById: "/test/gdqvCon/queryById",
                  add: "/test/gdqvCon/add",
                  edit: "/test/gdqvCon/edit",
                },
            }
        },
        created(){
             this.initFormData();
        },
        methods:{
           initFormData(){
               if(this.formData){
                    let dataId = this.formData.dataId;
                    this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{
                        if(res.data.success){
                            console.log("表单数据",res);
                            this.model = res.data.result;
                        }
                    })
                }
            },
            onSubmit() {
                let myForm = {...this.model};
                this.loading = true;
                let url = myForm.id?this.url.edit:this.url.add;
				this.$http.post(url,myForm).then(res=>{
				   console.log("res",res)
				   this.loading = false
				   this.$Router.push({name:this.backRouteName})
				}).catch(()=>{
					this.loading = false
				});
            }
        }
    }
</script>
